<?php

namespace App\Models\Common;

use App\Models\Setting\Setting;

class VziCloudTest
{
    public function test()
    {

        $config = [

        ];

//        dd(config('services.vzicloud.accessKeySecret'));

        $vzi = new VziCloud($config);

        $queryPacket = [
            'name' => '云停车',
            'sn' => '579eca4c-f58b4e55',
            'group_id' => '76064',
        ];

//        $res = $vzi->addGroup($queryPacket)->fire();
//        if ($groupId = \Arr::get($res, 'id')) {
//            Setting::updateOrCreate([
//                'category' => 'vzicloud',
//                'key' => 'group_id',
//            ], ['value' => $groupId]);
//        }

//        $res = $vzi->groups($queryPacket)->fire();

//        $res = $vzi->addDevice($queryPacket)->fire();
//        if ($failures = \Arr::get($res, 'failures')) {
//            $errRes = $failures[0]['error']; // 该设备已被当前公司或下游公司绑定
//            dd($errRes);
//        }

//        $res = $vzi->deviceInfo($queryPacket)->fire();

        $res = $vzi->deviceWebUrl($queryPacket)->fire();

        dd($res);
    }
}
